#include "symbol_table/SymbolBase.h"

#include <sstream>
#include <vector>


SymbolBase::SymbolBase(const std::string & strSymbolName, int iSymbolType)
: m_strSymbolName(strSymbolName)
, m_iSymbolType(iSymbolType)
{
}


SymbolBase::~SymbolBase(void)
{
}


const std::string & SymbolBase::getSymbolName() const
{
    return m_strSymbolName;
}


int SymbolBase::getSymbolType() const
{
	return m_iSymbolType;
}
std::string SymbolBase::toString() const
{
    std::stringstream str;
    str<<m_strSymbolName<<":"<<symbolTypeToString(m_iSymbolType);
    
    std::string res = str.str();
    return res;
}

std::string SymbolBase::symbolTypeToString(int iSymbolType)
{
    static std::string strSymbolTypes[] = {
#define SYMBOL_NAME
#include "symbol_table/SymbolDefine.h"
#undef SYMBOL_NAME
    };
    
    if(iSymbolType >= type_upper_bound || iSymbolType < 0)
        return "Wrong symbole type"; 
       
    return strSymbolTypes[iSymbolType];
}

void SymbolBase::setSymbolType( int iSymbolType )
{
	m_iSymbolType = iSymbolType;
}

